package stanford.com.balldating.base.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.project.framework.model.JSONModel;

import stanford.com.balldating.base.service.SysUserService;
import stanford.com.balldating.chat.service.UnReadMsgService;

@Controller
@RequestMapping("/")
public class IndexController {
	@Autowired
	private SysUserService userService;
	
	@Autowired
	private UnReadMsgService service;
	
	@ResponseBody
	@RequestMapping(value="/login",method=RequestMethod.POST)
	public JSONModel login(String username,String password){
		JSONModel model=new JSONModel();
		
		model.setSuccess(userService.login(username, password));
		
		return model;
	}
	
	@ResponseBody
	@RequestMapping(value="/register",method=RequestMethod.POST)
	public JSONModel register(String username,String password){
		return userService.register(username, password);
	}
	
	@RequestMapping(value="/live",method=RequestMethod.GET)
	public String live(String username){
		return "live";
	}
}
